#include<stdio.h>
#include<math.h>
double jc(int x)
{
  if(x>=2)
  {
    return x*jc(x-1);
  }
  else if(x==1)
  {
    return 1;
  }
}


double fun ( double x, double n )
{   
  double sum = 1;
  if(n==1)
  {
    return sum;
  }
  else
  {
    for(int i=2;i<=n;i++)
    {
      sum+=(pow(x,(2*i-2))/jc(2*i-2));
    }
  }
  return sum;
}
int main()
{
  double x,n;
  printf("Input x and n:");
  scanf("%lf%lf",&x,&n);
  printf("fun(%lf,%lf)=%8.3lf\n",x,n,fun(x,n));
  return 0;
}
